package com.zafu.util;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * ClassName: HomeStoreDbConn
 * Package: com.zafu.util
 * Description:
 *
 * @Author Wang
 * @Create 2024/12/1 11:04
 * @Version 1.0
 */
public class ElmDbConn {
    public static Connection GetConnection(){

        Connection con = null;
        try{
            Class.forName( "org.sqlite.JDBC" );// 加载Sqlite数据驱动
            String dbPath = "D:/androidProjects/elmWork/ElmManager/src/main/resources/Elm.db";
            String url = "jdbc:sqlite:"+dbPath;
            con = DriverManager.getConnection(url);
        }
        catch( Exception e ){
            e.printStackTrace();
            System.out.println( "数据库连接失败" );
        }
        return con;
    }
}
